package com.csg.ses.common.configuration;

import com.csg.ses.ws.ZncfService;
import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBus;
import org.apache.cxf.jaxws.EndpointImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.xml.ws.Endpoint;

/**
 * @auther wangjun
 * @time 2020/11/17 10:11
 * 服务发布类
 */
@Configuration
public class WebServiceConfig {

    @Autowired
    private ZncfService zncfService;

    @Bean(name = Bus.DEFAULT_BUS_ID)
    public SpringBus springBus() {
        return new SpringBus();
    }

    @Bean
    public Endpoint endpoint() {
        EndpointImpl endpoint = new EndpointImpl(springBus(), zncfService); //绑定要发布的服务
        endpoint.publish("/fscfyhqdtz");  //显示要发布的名称
        return endpoint;
    }
}